<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<style>
		.class2{
			background-color: white;
		}
	</style>
<script src="js/vue.js"></script>
	<body>
		
		<div id="app">
			<span :class="myclass" :style="{background:mycolor1}" @mouseover="over1()" @mouseout="ou()">教父</span>
			<span :class="myclass" :style="{background:mycolor2}" @mouseover="over2()" @mouseout="ou()">阿甘正传</span>
			<span :class="myclass" :style="{background:mycolor3}" @mouseover="over3()" @mouseout="ou()">楚门的世界</span>
			<span :class="myclass" :style="{background:mycolor4}" @mouseover="over4()" @mouseout="ou()">盗梦空间</span>
		</div>
		
	</body>
	<script>
		new Vue({
			el:"#app",
			data(){
				return{
					mycolor1:"",
					mycolor2:"",
					mycolor3:"",
					mycolor4:"",
					myclass:""
					
				}
			},
			methods:{
				over4(){
					this.mycolor1 = "red";
				},
				over1(){
					this.mycolor2 = "red";
				},
				over2(){
					this.mycolor3 = "red";
				},
				over3(){
					this.mycolor4 = "red";
				},
				ou(){
					this.myclass ="class2"
				}
				
			},
		})
	</script>
</html>
